<?php

    /**
     * @package      Barecode
     * @subpackage   Barcode
     *
     * @license      GNU Lesser General Public Licence see LICENCE-LGPL file or http://www.gnu.org/licenses/lgpl.html
     */
    abstract class Barcode_Adapter
    {

    ////////////////////////////////////////////////////////////////////////////
    //                                Contantes                               //
    ////////////////////////////////////////////////////////////////////////////

        const ADAPTER_CODE39   = 'code39';
        const ADAPTER_CODE128  = 'code128';
        const ADAPTER_EAN13    = 'ean13';
        const ADAPTER_QRCODE   = 'qrcode';

    ////////////////////////////////////////////////////////////////////////////
    //                                 Methods                                //
    ////////////////////////////////////////////////////////////////////////////

        /**
         * @param       string      $adapter
         * @throws      Core_Exception
         * @return      Barcode_Adapter_Abstract
         */
        public static function factory($adapter)
        {
            switch ($adapter) {
                case self::ADAPTER_CODE39:
                    return new Barcode_Adapter_Code39();
                    break;

                case self::ADAPTER_CODE128:
                    return new Barcode_Adapter_Code128();
                    break;

                case self::ADAPTER_EAN13:
                    return new Barcode_Adapter_Ean13();
                    break;

                case self::ADAPTER_QRCODE:
                    return new Barcode_Adapter_QRCode();
                    break;

                default:
                    throw new Core_Exception('Invalid adapter selected');
                    break;
            }
        }
    }